package com.vision.world.survey.fragments;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.vision.world.survey.R;
import com.vision.world.survey.presenter.SettingLayerPresenter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class SearchFragment extends Fragment {
    private Context mContext;

    private TextView txtKey1;
    private TextView txtKey2;
    private TextView txtKey3;
    private TextView txtValue1;
    private TextView txtValue2;
    private TextView txtValue3;
    private Map<String, Object> sResult = null;


    public SearchFragment() {
    }

    @SuppressLint({"NewApi", "ValidFragment"})
    public SearchFragment(Context context) {
        // Required empty public constructor
        mContext = context;
    }

    public void setsResult(Map<String, Object> result) {

        sResult = result;
        if(txtKey2!=null) {
            //刷新界面
            setResultInfo();
        }
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_search_result, container, false);

        txtKey1 = (TextView) view.findViewById(R.id.txt_result_key1);
        txtKey2 = (TextView) view.findViewById(R.id.txt_result_key2);
        txtKey3 = (TextView) view.findViewById(R.id.txt_result_key3);
        txtValue1 = (TextView) view.findViewById(R.id.txt_result_value1);
        txtValue2 = (TextView) view.findViewById(R.id.txt_result_value2);
        txtValue3 = (TextView) view.findViewById(R.id.txt_result_value3);
        setResultInfo();
        return view;
    }

    public void setResultInfo() {
        if (sResult != null) {
            txtKey2.setText("名称：");
            txtValue2.setText(sResult.get("NAME").toString());
        }
    }


}
